using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;using Maxleaf.EDI.Domain.K3;

namespace Maxleaf.EDI.DataAccess.K3
{
    public class POOrderMap : EntityTypeConfiguration<POOrder>
    {
        public POOrderMap()
        {
            // Primary Key
            this.HasKey(t => t.FInterID);

            // Properties
            this.Property(t => t.FBrNo)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.FInterID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FBillNo)
                .IsRequired()
                .HasMaxLength(255);

            this.Property(t => t.FCashDiscount)
                .IsRequired()
                .HasMaxLength(255);

            this.Property(t => t.FExplanation)
                .IsRequired()
                .HasMaxLength(255);

            this.Property(t => t.FFetchAdd)
                .IsRequired()
                .HasMaxLength(255);

            this.Property(t => t.FPOOrdBillNo)
                .HasMaxLength(510);

            this.Property(t => t.FOperDate)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(8)
                .IsRowVersion();

            this.Property(t => t.FValidaterName)
                .HasMaxLength(255);

            this.Property(t => t.FHeadSelfP0239)
                .HasMaxLength(255);

            this.Property(t => t.FHeadSelfP0240)
                .HasMaxLength(255);

            this.Property(t => t.FHeadSelfP0241)
                .HasMaxLength(255);

            this.Property(t => t.FHeadSelfP0242)
                .HasMaxLength(255);

            this.Property(t => t.FHeadSelfP0249)
                .HasMaxLength(255);

            // Table & Column Mappings
            this.ToTable("POOrder");
            this.Property(t => t.FBrNo).HasColumnName("FBrNo");
            this.Property(t => t.FTranType).HasColumnName("FTranType");
            this.Property(t => t.FInterID).HasColumnName("FInterID");
            this.Property(t => t.FBillNo).HasColumnName("FBillNo");
            this.Property(t => t.FSupplyID).HasColumnName("FSupplyID");
            this.Property(t => t.FDate).HasColumnName("FDate");
            this.Property(t => t.FEmpID).HasColumnName("FEmpID");
            this.Property(t => t.FDeptID).HasColumnName("FDeptID");
            this.Property(t => t.FCurrencyID).HasColumnName("FCurrencyID");
            this.Property(t => t.FCheckerID).HasColumnName("FCheckerID");
            this.Property(t => t.FBillerID).HasColumnName("FBillerID");
            this.Property(t => t.FMangerID).HasColumnName("FMangerID");
            this.Property(t => t.FClosed).HasColumnName("FClosed");
            this.Property(t => t.FTranStatus).HasColumnName("FTranStatus");
            this.Property(t => t.FExchangeRate).HasColumnName("FExchangeRate");
            this.Property(t => t.FStatus).HasColumnName("FStatus");
            this.Property(t => t.FCancellation).HasColumnName("FCancellation");
            this.Property(t => t.FPOStyle).HasColumnName("FPOStyle");
            this.Property(t => t.FMultiCheckLevel1).HasColumnName("FMultiCheckLevel1");
            this.Property(t => t.FMultiCheckLevel2).HasColumnName("FMultiCheckLevel2");
            this.Property(t => t.FMultiCheckLevel3).HasColumnName("FMultiCheckLevel3");
            this.Property(t => t.FMultiCheckLevel4).HasColumnName("FMultiCheckLevel4");
            this.Property(t => t.FMultiCheckLevel5).HasColumnName("FMultiCheckLevel5");
            this.Property(t => t.FMultiCheckLevel6).HasColumnName("FMultiCheckLevel6");
            this.Property(t => t.FMultiCheckDate1).HasColumnName("FMultiCheckDate1");
            this.Property(t => t.FMultiCheckDate2).HasColumnName("FMultiCheckDate2");
            this.Property(t => t.FMultiCheckDate3).HasColumnName("FMultiCheckDate3");
            this.Property(t => t.FMultiCheckDate4).HasColumnName("FMultiCheckDate4");
            this.Property(t => t.FMultiCheckDate5).HasColumnName("FMultiCheckDate5");
            this.Property(t => t.FMultiCheckDate6).HasColumnName("FMultiCheckDate6");
            this.Property(t => t.FCurCheckLevel).HasColumnName("FCurCheckLevel");
            this.Property(t => t.FRelateBrID).HasColumnName("FRelateBrID");
            this.Property(t => t.FOrderAffirm).HasColumnName("FOrderAffirm");
            this.Property(t => t.FCashDiscount).HasColumnName("FCashDiscount");
            this.Property(t => t.FCheckDate).HasColumnName("FCheckDate");
            this.Property(t => t.FExplanation).HasColumnName("FExplanation");
            this.Property(t => t.FFetchAdd).HasColumnName("FFetchAdd");
            this.Property(t => t.FSettleDate).HasColumnName("FSettleDate");
            this.Property(t => t.FSettleID).HasColumnName("FSettleID");
            this.Property(t => t.FSelTranType).HasColumnName("FSelTranType");
            this.Property(t => t.FChildren).HasColumnName("FChildren");
            this.Property(t => t.FBrID).HasColumnName("FBrID");
            this.Property(t => t.FPOOrdBillNo).HasColumnName("FPOOrdBillNo");
            this.Property(t => t.FAreaPS).HasColumnName("FAreaPS");
            this.Property(t => t.FClassTypeID).HasColumnName("FClassTypeID");
            this.Property(t => t.FTotalCostFor).HasColumnName("FTotalCostFor");
            this.Property(t => t.FlastModyDate).HasColumnName("FlastModyDate");
            this.Property(t => t.FOperDate).HasColumnName("FOperDate");
            this.Property(t => t.FManageType).HasColumnName("FManageType");
            this.Property(t => t.FSysStatus).HasColumnName("FSysStatus");
            this.Property(t => t.FValidaterName).HasColumnName("FValidaterName");
            this.Property(t => t.FHeadSelfP0239).HasColumnName("FHeadSelfP0239");
            this.Property(t => t.FHeadSelfP0240).HasColumnName("FHeadSelfP0240");
            this.Property(t => t.FHeadSelfP0241).HasColumnName("FHeadSelfP0241");
            this.Property(t => t.FHeadSelfP0242).HasColumnName("FHeadSelfP0242");
            this.Property(t => t.FHeadSelfP0247).HasColumnName("FHeadSelfP0247");
            this.Property(t => t.FHeadSelfP0249).HasColumnName("FHeadSelfP0249");
        }
    }
}
